Avoid fatal in Article::fetchContent()
authorBrad Jorsch <bjorsch@wikimedia.org>
Thu, 1 May 2014 14:12:25 +0000 (10:12 -0400)
committerBrad Jorsch <bjorsch@wikimedia.org>
Thu, 1 May 2014 14:12:25 +0000 (10:12 -0400)
The function is documented as returning false if there is no content to
the page, but this logic was lost in the ContentHandler change.

Even though it's "BC cruft", it still shouldn't fatal for something as
simple as a non-existent page.

Bug: 43737
Change-Id: Ic1924a42fa7b4227ac65838d0def6a66c3990573

includes/Article.php

index e73fe9d..0a4b5ee 100644 (file)
@@ -386,6 +386,11 @@ class Article implements Page {
 
                $content = $this->fetchContentObject();
 
+               if ( !$content ) {
+                       wfProfileOut( __METHOD__ );
+                       return false;
+               }
+
                // @todo Get rid of mContent everywhere!
                $this->mContent = ContentHandler::getContentText( $content );
                ContentHandler::runLegacyHooks( 'ArticleAfterFetchContent', array( &$this, &$this->mContent ) );